package com.kay.servlet;

import com.kay.server.Request;
import com.kay.server.Response;

import java.io.IOException;

/**
 * @Description:
 * @Author: Kay
 * @CreateDate: 2021/8/3$ 11:02$
 * @UpdateUser: Kay
 * @UpdateDate: 2021/8/3$ 11:02$
 */
public abstract class HttpServlet implements Servlet {
    public abstract void doGet(Request request, Response response) throws IOException;

    public abstract void doPost(Request request, Response response) throws IOException;

    @Override
    public void service(Request request, Response response) throws IOException {
        if ("GET".equalsIgnoreCase(request.getMethod())) {
            doGet(request, response);
        } else {
            doPost(request, response);
        }
    }
}
